# -*- coding: utf-8 -*-
"""
Created on Fri Mar 26 08:00:09 2021

@author: 雁痕
"""

import json
import random
from uuid import uuid4

from blockchain import Blockchain, Block
from transaction import Transaction
from ledger import Ledger

    
if __name__ == '__main__':
    ledger = Ledger()
    god = '00000000-0000-0000-0000-000000000000'
    Alice = str(uuid4())
    Bob = str(uuid4())
    
    block1 = Block()
    transaction1 = Transaction(sender=god, receiver=Alice,amount=198805)
    block1.add(transaction1)
    print(transaction1)
    ledger.add(block1)
    
    print(ledger.balance(Alice))
    
    block2 = Block()
    transaction2 = Transaction(sender=Alice, receiver=Bob,amount=898042)
    block2.add(transaction2)
    print(transaction1)
    ledger.add(block2)
    
    print(ledger.balance(Alice))
    print(ledger.balance(Bob))
    
